package com.github;

import com.github.bean.ServerUser;
import com.github.bean.User;
import com.github.manager.Manager;
import com.github.service.UserServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class DataController {

    @GetMapping("/api/is_server_online")
    public boolean getIsServerOnline(@RequestParam("account") String account) {
        ServerUser serverUser = Manager.accountUserMap.getOrDefault(account, null);
        if (serverUser == null)
            return false;
        return serverUser.isServerOnline();
    }
}